﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace MyToDo.Views
{
    /// <summary>
    /// MainView.xaml 的交互逻辑
    /// </summary>
    public partial class MainView : Window
    {
        public MainView()
        {
            InitializeComponent();

            //最小化
            minBtn.Click += (s, e) => { this.WindowState = WindowState.Minimized; };

            //铺满全屏/默认
            maxBtn.Click += (s, e) =>
            {

                if (this.WindowState == WindowState.Maximized)
                {
                    this.WindowState = WindowState.Normal;
                }
                else
                {
                    this.WindowState = WindowState.Maximized;

                }
            };
            //关闭窗口
            closeBtn.Click += (s, e) => { this.Close(); };

            //窗口拖动移动
            MainBody.MouseMove += (s, e) =>
            {

                if (e.LeftButton == MouseButtonState.Pressed)//如果鼠标左键按下
                {
                    this.DragMove();//窗口拖动移动
                }
            };
            //双击放大事件
            MainBody.MouseDoubleClick += (s, e) =>
            {
                if (this.WindowState == WindowState.Maximized)
                {
                    this.WindowState = WindowState.Normal;
                }
                else
                {
                    this.WindowState = WindowState.Maximized;

                }
            };
            //点击侧边栏收起事件
            menuBar.SelectionChanged += (s, e) =>
            {
                drawerHost.IsLeftDrawerOpen = false;
            };
        }
    }
}
